package pack0626;

import java.util.Random;

public class Computer {
    public String name;
    public String[] names = {"张飞","关羽","刘备"};//定义一个数组，提供三个名字
    int score;//  记录每一句的分数


    String type;//出拳类型
    Random r = new Random();//定义一个随机数

    public int showHand() {
        int n = r.nextInt(3) + 1;//一到三 （数组下标从零开始）

        if (n == 1) {
            type = "石头";
        } else if (n == 2) {
            type = "剪刀";
        } else {
            type = "布";
        }
        return  n;
    }
    //给电脑随机读取一个名字
    public void selectName(){
        int index=r.nextInt(names.length);
        this.name=names[index];
    }

}